Write stuff about your data..
disgust <- read_csv("https://github.com/debruine/ishe2019/raw/master/data/disgust.csv")
users <- read_csv("https://github.com/debruine/ishe2019/raw/master/data/users.csv")
data <- left_join(disgust, users, by = "user_id") %>%
filter(sex %in% c("male", "female")) %>%
gather(question, score, moral1:pathogen7) %>%
separate(question, c("domain", "n"), sep = -1) %>%
group_by(domain, user_id, sex) %>%
summarise(sum_score = sum(score, na.rm = FALSE)) %>%
ungroup()
ggplot(data, aes(x = sum_score, fill = domain)) +
geom_histogram(binwidth = 1, colour = "grey",
show.legend = FALSE) +
facet_grid(domain~sex)
ggplot(data, aes(x = sum_score,
colour = domain,
fill = domain)) +
geom_density(alpha = 0.5) +
theme_clean() +
scale_colour_manual(values = c("dodgerblue", "darkgreen", "red")) +
scale_fill_manual(values = c("dodgerblue", "darkgreen", "red"))
ggplot(data, aes(x = sum_score,
colour = domain,
fill = domain)) +
geom_freqpoly(alpha = 0.5, binwidth = 1) +
theme_clean() +
scale_colour_manual(values = c("dodgerblue", "darkgreen", "red")) +
scale_fill_manual(values = c("dodgerblue", "darkgreen", "red"))
ggplot(data, aes(x = domain, y = sum_score, fill = domain)) +
geom_boxplot(show.legend = FALSE) +
facet_grid(~sex) +
xlab("") +
ylab("Sum Score") +
ggtitle("Sex Differences in Disgust")
ggplot(data, aes(x = domain, y = sum_score, fill = domain)) +
geom_violin(show.legend = FALSE, fill = "white") +
geom_boxplot(show.legend = FALSE, width = .2) +
facet_grid(~sex) +
xlab("") +
ylab("Sum Score") +
ggtitle("Sex Differences in Disgust")
data_wide <- spread(data, domain, sum_score)
p <- sample_n(data_wide, 100) %>%
ggplot(aes(x = moral, y = sexual, colour = sex)) +
geom_point() +
geom_smooth(method = lm, se = FALSE)
ggplotly(p)
data_wide %>%
ggplot(aes(x = moral, y = sexual, colour = sex)) +
geom_point(alpha = 0.05) +
geom_smooth(method = lm, se = TRUE)
ggplot(data_wide, aes(x = pathogen, y = sexual)) +
geom_bin2d(binwidth = 1, drop = FALSE) +
scale_fill_viridis_c()
pathogen_sex_plot <- ggplot(data_wide,
aes(x = pathogen, y = sexual)) +
geom_smooth(method = lm)
pathogen_moral_plot <- ggplot(data_wide,
aes(x = pathogen, y = moral)) +
geom_smooth(method = lm)
plot_grid(pathogen_sex_plot, pathogen_moral_plot)